#!/bin/bash
# ffn digital-Playlist
# $1 = outfile

### Variabel
Name="ffn digital [www.ffn.de]"
### 

# get...
wget -q --tries=2 --timeout=5 -O /tmp/playlist "http://www.ffn.de/musik/playlist.html"
# grep actual song
all=`grep -A6 'wird gerade gespielt' /tmp/playlist`

# Artist/Title
artist=${all//*$'"artist">'/}; artist=${artist//$'</h3>'*/}
title=${all//*$'"title">'/}; title=${title//$'</h3>'*/}
# temp. no Info
artist=${artist:='---'}; titel=${title:='---'}

# write...
if [ $1 ]; then
	echo $Name    > $1
	echo $artist >> $1
	echo $title  >> $1
else
	echo "$Name: Interpret/Titel =  $artist / $title"
fi
